package io.renren.modules.yckj.dao;

import io.renren.common.dao.BaseDao;
import io.renren.modules.yckj.entity.OrderEntity;
import io.renren.modules.yckj.entity.TeamEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 课题组关系表
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2025-04-17
 */
@Mapper
public interface TeamDao extends BaseDao<TeamEntity> {
    /**
     * @param params 参数
     * @return 列表
     */
    List<TeamEntity> pageForAdmin(Map<String, Object> params);

    List<TeamEntity> getSearchList(Map<String, Object> params);

    List<TeamEntity> getTeamList(Map<String, Object> params);

    TeamEntity getTeamByName(Map<String, Object> params);

    /**
     * 更新余额
     *
     * @param teamId  组Id
     * @param balance 余额
     * @return 是否成功
     */
    boolean updateBalance(@Param("teamId") Long teamId, @Param("balance") BigDecimal balance);

    /**
     * 更新欠款
     *
     * @param teamId       用户Id
     * @param debtLimitUse 欠款
     * @return 是否成功
     */
    boolean updateDebtLimitUse(@Param("teamId") Long teamId, @Param("debtLimitUse") BigDecimal debtLimitUse);

    /**
     * 更新余额和欠款
     *
     * @param teamId       用户Id
     * @param balance      余额
     * @param debtLimitUse 欠款
     * @return 是否成功
     */
    boolean updateBalanceAndDebtLimitUse(@Param("teamId") Long teamId, @Param("balance") BigDecimal balance, @Param("debtLimitUse") BigDecimal debtLimitUse);

}